﻿using System;
using System.Collections.Generic;
using System.Text;

using NGE;

namespace MH.MENU
{
    public class Sys : Panelbox
    {
        public Sys(Game g)
            : base(g)
        {
            Name = "系统菜单";

            Location = new Microsoft.DirectX.Vector3(160 - 60, 120 - 40, 0);
            Size = new System.Drawing.Size(100, 80);

            btn1 = new Buttonbox();
            btn1.Textbox.Text = "返  回";
            btn1.Location = new Microsoft.DirectX.Vector3(0, 0, 0);
            btn1.OnButtonboxEvent += new MenuEvent(btn1_OnButtonboxEvent);

            AddElement(btn1);

            btn2 = new Buttonbox();
            btn2.Textbox.Text = "登入MHL";
            btn2.Location = new Microsoft.DirectX.Vector3(0, 20, 0);
            btn2.OnButtonboxEvent += new MenuEvent(btn2_OnButtonboxEvent);

            AddElement(btn2);

            btn3 = new Buttonbox();
            btn3.Textbox.Text = "登出MHL";
            btn3.Location = new Microsoft.DirectX.Vector3(0, 40, 0);
            btn3.OnButtonboxEvent += new MenuEvent(btn3_OnButtonboxEvent);

            AddElement(btn3);

            btn4 = new Buttonbox();
            btn4.Textbox.Text = "退  出";
            btn4.Location = new Microsoft.DirectX.Vector3(0, 60, 0);
            btn4.OnButtonboxEvent += new MenuEvent(btn4_OnButtonboxEvent);

            AddElement(btn4);
        }

        SceneComponent sceneCOM
        {
            get
            {
                return ((SceneComponent)game.GetComponent("SceneCOM"));
            }
        }
        ScriptComponent scriptCOM
        {
            get
            {
                return ((ScriptComponent)game.GetComponent("ScriptCOM"));
            }
        }

        void btn1_OnButtonboxEvent(object sender, object arg)
        {
            ButtonboxState bs = (ButtonboxState)arg;
            if (bs == ButtonboxState.Up)
            {
                scriptCOM.AS("menu close");
            }
        }

        void btn2_OnButtonboxEvent(object sender, object arg)
        {
            ButtonboxState bs = (ButtonboxState)arg;
            if (bs == ButtonboxState.Up)
            {
            }
        }

        void btn3_OnButtonboxEvent(object sender, object arg)
        {
            ButtonboxState bs = (ButtonboxState)arg;
            if (bs == ButtonboxState.Up)
            {
            }
        }

        void btn4_OnButtonboxEvent(object sender, object arg)
        {
            ButtonboxState bs = (ButtonboxState)arg;
            if (bs == ButtonboxState.Up)
            {
                scriptCOM.AS("exit");
            }
        }

        Buttonbox btn1;
        Buttonbox btn2;
        Buttonbox btn3;
        Buttonbox btn4;

    }
}
